home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_01 / saks / shape2.h < prev   
Encoding:
Text File  |  1993-11-07  |  499 b   |  28 lines

  1. Listing 2 - Member function and static member data definitions for 
  2. class shape
  3.  
  4. shape::shape(palette c) : _color(c) { }
  5.  
  6. shape::palette shape::color() const
  7.     {
  8.     return _color;
  9.     }
  10.  
  11. double shape::area() const
  12.     {
  13.     return 0;
  14.     }
  15.  
  16. const char *shape::name() const
  17.     {
  18.     return "point";
  19.     }
  20.  
  21. ostream &shape::put(ostream &os) const
  22.     {
  23.     return os << color_image[_color] << ' ' << name();
  24.     }
  25.  
  26. const char *shape::color_image[shape::RED - shape::BLUE + 1] =
  27.     { "blue", "green", "red" };
  28.